package com.flute.icrawler.app.task.entity;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.flute.icrawler.app.task.ITaskState;

public class RunningTaskState implements ITaskState {

	private static Logger logger = LoggerFactory
			.getLogger(RunningTaskState.class);

	@Override
	public ITaskState handle(CrawlTask crawlTask) {
		logger.info("I'm processing crawlTask name=" + crawlTask.getName());
		crawlTask.loadTaskInfo();
		if (crawlTask.isFinished()) {
			crawlTask.setFinished();
			return CrawlTask.STATE_FINISH;
		}
		return null;
	}

}
